<?php
require_once "session.php";
$icon=$_FILES["icon"];
$weixin_id=$_SESSION["user"];
$user = $core->GetUserByWxId($weixin_id);
$path=null;
if(isset($icon)){
    $path="icon".time().substr($icon["name"],strrpos($icon["name"],"."));
    $result=$core->UpdateUser($user["id"],$user["phone"],$path,$user["name"]);
    if($result==""){
        @unlink("../wap/user_icon/".$user["icon"]);
        move_uploaded_file($icon["tmp_name"],"../wap/user_icon/".$path);
        echo "../wap/user_icon/".$path;
    }else{
        echo "失败";
    }
}
